# 导入时间模块
import time
# 装饰函数
def computer_runtime(func):
    # 把run方法扩展功能之后的新方法
    def wrapper(*args,**kwargs):
        # 开始
        start = time.time()
        print(start)
        # 调用
        func(*args,**kwargs)
        print(func(*args,**kwargs))
        end = time.time()
        print(end)
        print('%s执行了%f 秒' % (func.__name__, end - start))

    # 回调
    return wrapper

@computer_runtime
# 被装饰函数
def run(a,k = None):
    # 休眠 1 秒
    time.sleep(1)
    # 推导式
    l = [x**2 * a - k for x in range(1000)]
    return l
run(1,k=2)




def m(n):
    def nb(c):
        print('---------------')
        n(c)
        print('---------------')
    return nb
def k(n):
    def nb(c):
        print('%%%%%%%%%%%%%%%%%%')
        n(c)
        print('%%%%%%%%%%%%%%%%%%')
    return nb
def u(n):
    def nb(c):
        print('---------------')
        n(c)
        print('---------------')
    return nb
def y(n):
    def nb(c):
        print('%%%%%%%%%%%%%%%%%%')
        n(c)
        print('%%%%%%%%%%%%%%%%%%')
    return nb
@y
@u
@k
@m
def ych(name):
    print(name, '追风少年，哈撒给')
ych('亚索')
